home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / X11R4 / cmds / X / ddx / Xsun / patches / sunCG6C.c.patch < prev    next >
Encoding:
Text File  |  1991-11-05  |  4.9 KB  |  225 lines

  1. *** /tmp/,RCSt1594232    Mon Nov  4 17:41:16 1991
  2. --- sunCG6C.c    Tue Jan  8 23:00:51 1991
  3. ***************
  4. *** 40,55 ****
  5.   #endif
  6.   
  7.   #include    "sun.h"
  8.   
  9. - #ifdef FBTYPE_SUNFAST_COLOR
  10.   #include    <sys/mman.h>
  11.   #include    <pixrect/memreg.h>
  12.   #include    <sundev/cg6reg.h>
  13.   #include    "colormap.h"
  14.   #include    "colormapst.h"
  15.   #include    "resource.h"
  16. - #include    <struct.h>
  17.   
  18.   #define    CG6_HEIGHT    900
  19.   #define    CG6_WIDTH    1152
  20.   
  21. --- 40,62 ----
  22.   #endif
  23.   
  24.   #include    "sun.h"
  25. + #include    <sys/types.h>
  26. + #include "sys/fb.h"
  27. + #include "sys/ioctl.h"
  28. + #include "kernel/vmMach.h"
  29. + #undef    MAP_NEW
  30.   
  31.   #include    <sys/mman.h>
  32. + #ifndef    sprite
  33.   #include    <pixrect/memreg.h>
  34.   #include    <sundev/cg6reg.h>
  35. + #include    <struct.h>
  36. + #endif    sprite
  37.   #include    "colormap.h"
  38.   #include    "colormapst.h"
  39.   #include    "resource.h"
  40.   
  41. + #ifndef    sprite
  42.   #define    CG6_HEIGHT    900
  43.   #define    CG6_WIDTH    1152
  44.   
  45. ***************
  46. *** 61,66 ****
  47. --- 68,74 ----
  48.   #define CG6_IMAGE(fb)        ((caddr_t)(&(fb)->cpixel))
  49.   #define CG6_IMAGEOFF        ((off_t)0x0)
  50.   #define CG6_IMAGELEN        (((CG6_HEIGHT*CG6_WIDTH + 8191)/8192)*8192)
  51. + #endif    sprite
  52.   
  53.   static int  sunCG6CScreenIndex;
  54.   
  55. ***************
  56. *** 75,81 ****
  57.       int        index, count;
  58.       u_char    *rmap, *gmap, *bmap;
  59.   {
  60. !     struct fbcmap sunCmap;
  61.   
  62.       sunCmap.index = index;
  63.       sunCmap.count = count;
  64. --- 83,89 ----
  65.       int        index, count;
  66.       u_char    *rmap, *gmap, *bmap;
  67.   {
  68. !     fbcmap    sunCmap;
  69.   
  70.       sunCmap.index = index;
  71.       sunCmap.count = count;
  72. ***************
  73. *** 123,133 ****
  74.   {
  75.       int        state = on;
  76.   
  77. !     if (on != SCREEN_SAVER_ON) {
  78.       SetTimeSinceLastInputEvent();
  79.       state = 1;
  80. !     } else {
  81.       state = 0;
  82.       }
  83.       (void) ioctl(sunFbs[pScreen->myNum].fd, FBIOSVIDEO, &state);
  84.       return( TRUE );
  85. --- 131,148 ----
  86.   {
  87.       int        state = on;
  88.   
  89. !     switch (on) {
  90. !     case SCREEN_SAVER_FORCER:
  91.       SetTimeSinceLastInputEvent();
  92.       state = 1;
  93. !     break;
  94. !     case SCREEN_SAVER_OFF:
  95. !     state = 1;
  96. !     break;
  97. !     case SCREEN_SAVER_ON:
  98. !     default:
  99.       state = 0;
  100. +     break;
  101.       }
  102.       (void) ioctl(sunFbs[pScreen->myNum].fd, FBIOSVIDEO, &state);
  103.       return( TRUE );
  104. ***************
  105. *** 153,161 ****
  106. --- 168,182 ----
  107.       ScreenPtr    pScreen;
  108.   {
  109.       Bool    ret;
  110. +     u_char rmap[256], gmap[256], bmap[256];
  111.   
  112.       pScreen->CloseScreen = (Bool (*)()) pScreen->devPrivates[sunCG6CScreenIndex].ptr;
  113.       ret = (*pScreen->CloseScreen) (i, pScreen);
  114. +     /* the following 2 lines are to fix rr clear_colormap bug */
  115. +     rmap[255] = gmap[255] = bmap[255] = 0;
  116. +     sunCG6CUpdateColormap(pScreen, 255, 1, rmap, gmap, bmap);
  117.       sunCG6CInstalledMap = NULL;
  118.       (void) (*pScreen->SaveScreen) (pScreen, SCREEN_SAVER_OFF);
  119.       return ret;
  120. ***************
  121. *** 404,409 ****
  122. --- 425,433 ----
  123.       int        imagelen;
  124.       caddr_t    mapaddr;
  125.       caddr_t    addr;
  126. + #ifdef sprite
  127. +     int        sizeToUse;
  128. + #endif /* sprite */
  129.   
  130.       if ((fd = sunOpenFrameBuffer(FBTYPE_SUNFAST_COLOR, &fbType, index, fbNum,
  131.                    argc, argv)) < 0)
  132. ***************
  133. *** 415,420 ****
  134. --- 439,445 ----
  135.       addr = 0;
  136.   
  137.   #ifndef    _MAP_NEW
  138. + #ifndef sprite
  139.       addr = (caddr_t) valloc(mapsize);
  140.       if (addr == (caddr_t) NULL) {
  141.       ErrorF("Could not allocate room for frame buffer.\n");
  142. ***************
  143. *** 421,428 ****
  144. --- 446,468 ----
  145.       (void) close (fd);
  146.       return FALSE;
  147.       }
  148. + #endif /* sprite */
  149.   #endif    _MAP_NEW
  150.   
  151. + #ifdef sprite
  152. +     sizeToUse = ((mapsize + VMMACH_SEG_SIZE) & ~(VMMACH_SEG_SIZE-1))
  153. +         + VMMACH_SEG_SIZE;
  154. +     addr = (caddr_t) malloc(sizeToUse);
  155. +     if (addr == (caddr_t) NULL) {
  156. +     ErrorF("Could not allocate room for frame buffer.\n");
  157. +     return FALSE;
  158. +     }
  159. +     addr = (caddr_t) mmap((caddr_t) addr,
  160. +          mapsize,
  161. +          PROT_READ | PROT_WRITE,
  162. +          MAP_SHARED, fd, 0);
  163. +     if (addr == (caddr_t) NULL) {
  164. + #else
  165.       mapaddr = (caddr_t) mmap((caddr_t) addr,
  166.            mapsize,
  167.            PROT_READ | PROT_WRITE,
  168. ***************
  169. *** 430,448 ****
  170.   
  171.   
  172.       if (mapaddr == (caddr_t) -1) {
  173.       Error("Mapping cg6c");
  174.       (void) close(fd);
  175.       return FALSE;
  176.       }
  177.   
  178.       if (mapaddr == 0)
  179.           mapaddr = addr;
  180.   
  181. -     sunFbs[index].fd = fd;
  182.       sunFbs[index].info = fbType;
  183. !     sunFbs[index].fb = (pointer) mapaddr;
  184.       sunFbs[index].EnterLeave = sunCG6CSwitch;
  185.       sunSupportsDepth8 = TRUE;
  186.       return TRUE;
  187.   }
  188.   
  189. --- 470,495 ----
  190.   
  191.   
  192.       if (mapaddr == (caddr_t) -1) {
  193. + #endif /* sprite */
  194.       Error("Mapping cg6c");
  195.       (void) close(fd);
  196.       return FALSE;
  197.       }
  198.   
  199. + #ifndef sprite
  200.       if (mapaddr == 0)
  201.           mapaddr = addr;
  202. + #endif /* sprite */
  203.   
  204.       sunFbs[index].info = fbType;
  205. ! #ifndef sprite
  206. !     sunFbs[index].fb = (pointer) fba.fb_buffer;
  207. ! #else
  208. !     sunFbs[index].fb = (pointer) addr;
  209. ! #endif /* sprite */
  210.       sunFbs[index].EnterLeave = sunCG6CSwitch;
  211.       sunSupportsDepth8 = TRUE;
  212. +     sunFbs[index].fd = fd;
  213.       return TRUE;
  214.   }
  215.   
  216. ***************
  217. *** 466,469 ****
  218.       return TRUE;
  219.       return FALSE;
  220.   }
  221. - #endif /* FBTYPE_SUNFAST_COLOR */
  222. --- 513,515 ----
  223.